//
//  HCMineHeadTableViewCell.m
//  HappyChildren
//
//  Created by WillyZhao on 2017/1/2.
//  Copyright © 2017年 WillyZhao. All rights reserved.
//

#import "HCMineHeadTableViewCell.h"

#import "HCMineMsgModel.h"

@implementation HCMineHeadTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.lineView.backgroundColor = YBKRGBCOLOR(241, 241, 241, 1);
    
    // Initialization code
}

-(void)cellModel:(NSIndexPath *)indexPath dataModel:(id)model{
    HCMineMsgModel *mineModel = (HCMineMsgModel *)model;

    
    
    if (indexPath.section == 0) {
        if (indexPath.row == 0) {
            self.textLabel1.text = @"昵称";
            [self stringaLabel:self.dexsLabel valueStr:[NSString stringWithFormat:@"%@",mineModel.name]];
        }else{
            self.textLabel1.text = @"会员状态";
            if ([mineModel.vipcard integerValue] == 0) {
                self.dexsLabel.text = @"非会员";
                self.dexsLabel.textColor = YBKRGBCOLOR(240, 96, 96, 1);
            }else{
//                self.dexsLabel.text = ;
                self.dexsLabel.textColor = [UIColor lightGrayColor];
                [self stringaLabel:self.dexsLabel valueStr:[NSString stringWithFormat:@"%@",mineModel.vipcard]];
            }
        }
    }else if (indexPath.section == 1) {
        if (indexPath.row == 0) {
            self.textLabel1.text = @"电话";
            [self stringaLabel:self.dexsLabel valueStr:[NSString stringWithFormat:@"%@",mineModel.phone]];
//            self.dexsLabel.text = ;
        }    }else if(indexPath.section == 2){
        if (indexPath.row == 0) {
            self.textLabel1.text = @"宝宝姓名";
            [self stringaLabel:self.dexsLabel valueStr:[NSString stringWithFormat:@"%@",mineModel.chi_name]];
//            self.dexsLabel.text = ;
        }else{
            self.textLabel1.text = @"宝宝生日";
            [self stringaLabel:self.dexsLabel valueStr:[NSString stringWithFormat:@"%@",mineModel.chi_bir]];
        }
    }else{
        self.dexsLabel.hidden = YES;
        if (indexPath.row == 0) {
            self.textLabel1.text = @"登录密码";
        }
    }
}

-(void)stringaLabel:(UILabel *)label valueStr:(NSString *)str {
    if ([PublicFunction isNull:str]) {
        label.text = @"";
    }else{
        if ([str isEqualToString:@"(null)"]) {
            label.text = @"";
        }else{
            label.text = str;
        }
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
